using System.Collections.Generic;

namespace DataAssociations.AssociationMiningAlgorithms.FpTree
{
    internal class CustomComparer : IComparer<string>
    {
        private Dictionary<string, int> _occurances;

        public CustomComparer(Dictionary<string, int> occurances)
        {
            _occurances = occurances;
        }

        public int Compare(string charA, string charB)
        {
            if (_occurances[charA] > _occurances[charB])
                return -1;
            if (_occurances[charA] < _occurances[charB])
                return 1;
            return 0;
        }
    }
}